package com.n4v1.pko.server.network.clientpackets;

import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;

import com.n4v1.pko.server.network.serverpackets.Authentification;

public class AllowConnection implements Runnable {

	private ServerSocket serverSocket = null;
    private Socket socket = null;
    public Thread t1;

    public AllowConnection(ServerSocket ss) {
        serverSocket = ss;
    }

    public void run() {
        try {
            while (true) {
                socket = serverSocket.accept();
                System.out.println("Client just arrived.");
                t1 = new Thread(new Authentification(socket));
                t1.start();
            }
        } catch (IOException e) {
            System.err.println("Server error.");
        }
    }
}
